function ccrPlayerMovingSpeed()
	return ccrUnitMovingSpeed("player");
end
function ccrPMS()
	return ccrPlayerMovingSpeed()
end
function _PlayerMovingSpeed()
	return ccrUnitMovingSpeed("player");
end
-----------------------------------------------------------
function ccrPlayerHealth()
	return ccrUnitHealth("player")
end
function ccrPH()
	return ccrPlayerHealth()
end
function _PlayerHealth()
	return ccrPlayerHealth()
end
-----------------------------------------------------------
function ccrPlayerMana()
	return ccrUnitMana("player")
end
function ccrPM()
	return ccrPlayerMana()
end
function _PlayerMana()
	return ccrPlayerMana()
end
-----------------------------------------------------------
function ccrPlayerName()
	return ccrUnitName("player")
end
function ccrPN()
	return ccrPlayerName()
end
function _PlayerName()
	return ccrPlayerName()
end
-----------------------------------------------------------
function ccrPlayerLevel()
	return ccrUnitLevel("player")
end
function ccrPL()
	return ccrPlayerLevel()
end
function _PlayerLevel()
	return ccrPlayerLevel()
end
-----------------------------------------------------------
function ccrPlayerTarget()
	return ccrUnitTarget("player")
end
function ccrPT()
	return ccrPlayerTarget()
end
function _PlayerTarget()
	return ccrPlayerTarget()
end
-----------------------------------------------------------
function ccrPlayerRace()
	return ccrUnitRace("player")
end
function ccrPR()
	return ccrPlayerRace()
end
function _PlayerRace()
	return ccrPlayerRace()
end
-----------------------------------------------------------
function ccrPlayerSpec()
	return ccrUnitSpec("player")
end
function ccrPS()
	return ccrPlayerSpec()
end
function ccrSpec()
	return ccrPlayerSpec()
end
function _PlayerSpec()
	return ccrPlayerSpec()
end
-----------------------------------------------------------
function ccrPlayerClass()
	return ccrUnitClass("player")
end
function ccrPC()
	return ccrPlayerClass()
end
function ccrClass()
	return ccrPlayerClass()
end
function _PlayerClass()
	return ccrPlayerClass()
end
-----------------------------------------------------------
function ccrPlayerBuffDuration(buff)
	return ccrUnitBuffDuration("player", buff)
end
function ccrPBD(buff)
	return ccrPlayerBuffDuration(buff)
end
function _PlayerBuffDuration(buff)
	return ccrPlayerBuffDuration(buff)
end
-----------------------------------------------------------
function ccrPlayerHasBuff(buff)
	return ccrUnitHasBuff("player", buff)
end
function ccrPHB(buff)
	return ccrPlayerHasBuff(buff)
end
function _PlayerHasBuff(buff)
	return ccrPlayerHasBuff(buff)
end
-----------------------------------------------------------
function ccrPlayerHasBuffRemaining(buff, time)
	return ccrUnitHasBuffRemaining("player", buff, time)
end
function ccrPHBR(buff, time)
	return ccrPlayerHasBuffRemaining(buff, time)
end
function _PlayerHasBuffRemaining(buff,time)
	return ccrPlayerHasBuffRemaining(buff, time)
end
-----------------------------------------------------------
function ccrPlayerHasBuffStacks(buff, stacks)
	return ccrUnitHasBuffStacks("player", buff, stacks)
end
function ccrPHBS(buff, stacks)
	return ccrPlayerHasBuffStacks(buff, stacks)
end
function _PlayerHasBuffStacks(buff, stacks)
	return ccrPlayerHasBuffStacks(buff, stacks)
end
-----------------------------------------------------------
function ccrPlayerHasDebuff(debuff)
	return ccrUnitHasDebuff("player", debuff)
end
function ccrPHDB(debuff)
	return ccrPlayerHasDebuff(debuff)
end
function _PlayerHasDebuff(debuffs)
	return ccrPlayerHasDebuff(debuff)
end	
-----------------------------------------------------------
function ccrPlayerHasDebuffRemaining(debuff, time)
	return ccrUnitHasDebuffRemaining("player", debuff, time)
end
function ccrPHDBR(debuff, time)
	return ccrPlayerHasDebuffRemaining(debuff, time)
end
function _PlayerHasDebuffRemaining(debuff, time)
	return ccrPlayerHasDebuffRemaining(debuff, time)
end
-----------------------------------------------------------
function ccrPlayerHasDebuffDuration(debuff)
	return ccrUnitHasDebuffDuration("player", debuff)
end
function ccrPHDBD(debuff)
	return ccrPlayerHasDebuffDuration(debuff)
end
function _PlayerHasDebuffDuration(debuff)
	return ccrPlayerHasDebuffDuration(debuff)
end
-----------------------------------------------------------
function ccrPlayerHasDebuffStacks(debuff, stacks)
	return ccrUnitHasDebuffStacks("player", debuff, stacks)
end
function ccrPHDBS(debuff, stacks)
	return ccrPlayerHasDebuffStacks(debuff, stacks)
end
function _PlayerHasDebuffStacks(debuff, stacks)
	return ccrUnitHasDebuffStacks("player", debuff, stacks)
end
-----------------------------------------------------------
function ccrPlayerIsMoving()
	return ccrUnitIsMoving("player")
end
function ccrPIM()
	return ccrPlayerIsMoving()
end
function _PlayerIsMoving()
	return ccrPlayerIsMoving()
end
-----------------------------------------------------------
function ccrPlayerIsCasting()
	return ccrUnitIsCasting("player")
end
function ccrPICA()
	return ccrPlayerIsCasting()
end
function _PlayerIsCasting()
	return ccrPlayerIsCasting()
end
-----------------------------------------------------------
function ccrPlayerIsCastingSpell(spell)
	return ccrUnitIsCastingSpell("player",spell)
end
function ccrPICAS(spell)
	return ccrPlayerIsCastingSpell(spell)
end
function _PlayerIsCastingSpell(spell)
	return ccrPlayerIsCastingSpell(spell)
end
-----------------------------------------------------------
function ccrPlayerIsChanneling()
	return ccrUnitIsChanneling("player")
end
function ccrPICH()
	return ccrPlayerIsChanneling()
end
function _PlayerIsChanneling()
	return ccrUnitIsChanneling("player")
end
-----------------------------------------------------------
function ccrPlayerIsChannelingSpell(spell)
	return ccrUnitIsChannelingSpell("player", spell)
end
function ccrPICHS(spell)
	return ccrPlayerIsChannelingSpell(spell)
end
function _PlayerIsChannelingSpell(spell)
	return ccrPlayerIsChannelingSpell(spell)
end
-----------------------------------------------------------
function ccrPlayerIsCastingOrChanneling()
	return ccrUnitIsCastingOrChanneling("player")
end
function ccrPICAOCH()
	return ccrPlayerIsCastingOrChanneling()
end
function _PlayerIsCastingOrChanneling()
	return ccrPlayerIsCastingOrChanneling()
end
-----------------------------------------------------------
function ccrPlayerHasLeftOnCast(time)
	return ccrUnitHasLeftOnCast("player", time)
end
function ccrPHLOCA(time)
	return ccrPlayerHasLeftOnCast(time)
end
function _PlayerHasLeftOnCast(time)
	return ccrUnitHasLeftOnCast("player", time)
end
-----------------------------------------------------------
function ccrPlayerHasLeftOnChannel(time)
	return ccrUnitHasLeftOnChannel("player", time)
end
function ccrPHLOCH(time)
	return ccrUnitHasLeftOnChannel("player", time)
end
function _PlayerHasLeftOnChannel(time)
	return ccrUnitHasLeftOnChannel("player", time)
end
-----------------------------------------------------------
function ccrPlayerIsAlive()
	return ccrUnitIsAlive("player")
end
function ccrPIA()
	return ccrPlayerIsAlive()
end
function _PlayerIsAlive()
	return ccrUnitIsAlive("player")
end
-----------------------------------------------------------
function ccrPlayerIsDead()
	return ccrUnitIsDead("player")
end
function ccrPID()
	return ccrPlayerIsDead()
end
function _PlayerIsDead()
	return ccrPlayerIsDead()
end
-----------------------------------------------------------
function ccrPlayerIsTank()
	return ccrUnitIsTank("player")
end
function ccrPITank()
	return ccrPlayerIsTank()
end
function _PlayerIsTank()
	return ccrPlayerIsTank()
end
-----------------------------------------------------------
function ccrPlayerIsHealer()
	return ccrUnitIsHealer("player")
end
function ccrPIHEALER()
	return ccrPlayerIsHealer()
end
function _PlayerIsHealer()
	return ccrPlayerIsHealer()
end
-----------------------------------------------------------
function ccrPlayerIsDPS()
	return ccrUnitIsDPS("player")
end
function ccrPIDPS()
	return ccrPlayerIsDPS()
end
function _PlayerIsDPS()
	return ccrPlayerIsDPS()
end
-----------------------------------------------------------
function ccrPlayerPower()
	local vPower = nil
	if ccrPlayerClass() == "Warrior" then vPower = 1 end
	if ccrPlayerClass() == "Hunter" then vPower = 2 end
	if ccrPlayerClass() == "Rogue" then vPower = 3 end
	if ccrPlayerClass() == "Druid" and ccrSpec() == 2 then vPower = 3 end
	if ccrPlayerClass() == "Death Knight" then vPower = 6 end
	if ccrPlayerClass() == "Warlock" and ccrSpec() == 1 then vPower = 7 end
	if ccrPlayerClass() == "Warlock" and ccrSpec() == 2 then vPower = 15 end
	if ccrPlayerClass() == "Warlock" and ccrSpec() == 3 then vPower = 14 end
	if ccrPlayerClass() == "Druid" and ccrSpec() == 1 then vPower = 2 end
	if ccrPlayerClass() == "Paladin" then vPower = 9 end
	if ccrPlayerClass() == "Monk" then vPower = 12 end
	if ccrPlayerClass() == "Priest" and ccrSpec() == 3 then vPower = 13 end
	if vPower ~= nil then return UnitPower("player", vPower) end
end
function ccrPP()
	return ccrPlayerPower()
end
function _PlayerPower()
	return ccrPlayerPower()
end
-----------------------------------------------------------
function ccrEmbers()
	return UnitPower("player", 14, true)
end
function _Embers()
	return ccrEmbers()
end
-----------------------------------------------------------
function ccrOrbs()
	return UnitPower("player", 13)
end
function _Orbs()
	return ccrOrbs()
end
-----------------------------------------------------------
function ccrPlayerChi()
	return UnitPower("player", 12)
end
function ccrChi()
	return ccrPlayerChi()
end
function _Chi()
	return ccrPlayerChi()
end
-----------------------------------------------------------
function ccrPlayerEnergy()
	return UnitPower("player", 3)
end
function ccrEnergy()
	return ccrPlayerEnergy()
end
function _Energy()
	return ccrPlayerEnergy()
end
-----------------------------------------------------------
function ccrPlayerFocus()
	return UnitPower("player", 2)
end
function ccrFocus()
	return ccrPlayerFocus()
end
function _Focus()
	return ccrPlayerFocus()
end
-----------------------------------------------------------
function ccrPlayerRunicPower()
	return UnitPower("player", 6)
end
function ccrRunicPower()
	return ccrPlayerRunicPower()
end
function _RunicPower()
	return ccrPlayerRunicPower()
end
-----------------------------------------------------------
function ccrComboPoints()
	if UnitExists("target") == 1 then
		return GetComboPoints("player", "target")
	else
		return 0
	end
end
function ccrPlayerComboPoints()
	return ccrComboPoints()
end
function ccrPoints()
	return ccrComboPoints()
end
function _ComboPoints()
	return ccrComboPoints()
end
-----------------------------------------------------------
function ccrPlayerIsInCombat()
	return ccrUnitIsInCombat("player")
end
function ccrPIIC()
	return ccrPlayerIsInCombat()
end
function _PlayerIsInCombat()
	return ccrPlayerIsInCombat()
end
-----------------------------------------------------------
function ccrPlayerIsInStealth()
	if IsStealthed() == 1 then
		return true
	else
		return false
	end
end
function ccrPIIS()
	return ccrPlayerIsInStealth()
end
function _PlayerIsInStealth()
	return ccrPlayerIsInStealth()
end
-----------------------------------------------------------
function ccrPlayerShards()
	return UnitPower("player", 7)
end
function ccrShards()
	return ccrPlayerShards()
end
function _PlayerShards()
	return ccrPlayerShards()
end
-----------------------------------------------------------
function ccrPlayerFury()
	return UnitPower("player", 15)
end
function ccrFury()
	return ccrPlayerFury()
end
function _PlayerFury()
	return ccrPlayerFury()
end
-----------------------------------------------------------
function ccrPlayerRage()
	return UnitPower("player", 17)
end
function ccrRage()
	return ccrPlayerRage()
end
function _PlayerRage()
	return ccrPlayerRage()
end
-----------------------------------------------------------
function ccrPlayerRageMax()
	return UnitPowerMax("player", 17)
end
function ccrRageMax()
	return ccrPlayerRage()
end
function _PlayerRageMax()
	return ccrPlayerRage()
end
-----------------------------------------------------------
function ccrPlayerHolyPower()
	return UnitPower("player", 9)
end
function ccrHolyPower()
	return ccrPlayerHolyPower()
end
function _PlayerHolyPower()
	return ccrPlayerHolyPower()
end
-----------------------------------------------------------
function PlayerIsInArena()
	for i = 1, # ArenaList do
		if GetRealZoneText() == ArenaList[i] then
			return true
		end
	end
	return false
end
function PlayerIsInBG()
	for i = 1, # BattlegroundsList do
		if GetRealZoneText() == BattlegroundsList[i] then
			return true
		end
	end
	return false
end
function PlayerIsInDungeon()
	for i = 1, # DungeonList do
		if GetRealZoneText() == DungeonList[i] then
			return true
		end
	end
	return false
end
function PlayerIsInRaid()
	for i = 1, # RaidList do
		if GetRealZoneText() == RaidList[i] then
			return true
		end
	end
	return false
end
function PlayerIsInScenario()
	for i = 1, # ScenarioList do
		if GetRealZoneText() == ScenarioList[i] then
			return true
		end
	end
	return false
end
function PlayerIsSOLO()
	if not PlayerIsInArena()
	and not PlayerIsInBG()
	and not PlayerIsInRaid()
	and not PlayerIsInDungeon()
	and not PlayerIsInScenario()
	then
		return true
	else
		return false
	end
end
function ccrPlayerIsInGroup()
	local vNumCount = GetNumGroupMembers()
	if vNumCount > 0 then
		return true
	else
		return false
	end
end
function ccrPlayerIsCat()
	if ccrPlayerHasBuff("Cat Form") then
		return true
	else
		return false
	end
end
function ccrPlayerIsCaster()
	if GetShapeshiftForm() == 0 then
		return true
	else
		return false
	end
end
function ccrPlayerIsBear()
	if ccrPlayerHasBuff("Bear Form")
	then
		return true
	else
		return false
	end
end
function ccrPlayerIsInControl()
	if UnitOnTaxi("player") == nil	
	and HasFullControl() == 1
	and not Player:IsDead()
	and UnitUsingVehicle("player") == nil
	and IsUsingVehicleControls() == nil
	then
		return true
	else
		return false
	end
end
function ccrPlayerIsMelee()
	if (ccrPlayerClass() == "Paladin" and ccrPlayerSpec() == 2 or ccrPlayerSpec() == 3 or ccrPlayerSpec() == nil)
	or ccrPlayerClass() == "Rogue"
	or ccrPlayerClass() == "Death Knight"
	or (ccrPlayerClass() == "Shaman" and (ccrPlayerSpec() == 2 or ccrPlayerSpec() == nil))
	or ccrPlayerClass() == "Warrior"
	or (ccrPlayerClass() == "Druid" and ccrPlayerSpec() == 2 or ccrPlayerSpec() == 3 or ccrPlayerSpec() == nil)
	or ccrPlayerClass() == "Monk"
	then
		return true
	else
		return false
	end
end
function ccrPlayerIsRanged()
	if ccrPlayerClass() == "Hunter"
	or ccrPlayerClass() == "Mage"
	or ccrPlayerClass() == "Warlock"
	or (ccrPlayerClass() == "Shaman" and (ccrPlayerSpec() == 1 or ccrPlayerSpec() == 3 or ccrPlayerSpec() == nil))
	or (ccrPlayerClass() == "Druid" and ccrPlayerSpec() == 1)
	then
		return true
	else
		return false
	end
end
function ccrPlayerIsBehindTarget()
	if ccrValidTarget() then
		if Target
		and Target:Exists()
		and Player:IsBehind(Target) then
			return true
		else
			return false
		end
	else
		return false
	end
end
function ccrStance()
	vStance = GetShapeshiftForm()
	if vStance ~= nil then
		return vStance
	end
end

function ccrPlayerHasTalent(name)
	if name == nil then return end
	if tonumber(name) ~= nil then name = SpellIDToName(name) end
	local i
	-- Scan through the entire talent list
	for i = 0, 18 do
		local tempTalent = {GetTalentInfo(i)}
		-- Find the matching name of the talent
		-- if true, we have it
		if tempTalent[1] == name
		and tempTalent[6]
		then
			return true
		end
	end
	-- Didn't find the talent
	return false
end

function ccrPlayerHasSpell(name)
	-- Instead of needing spellid, we can use GetSpellLink
	-- this will only return a value if the player has the spell
	if tonumber(name) ~= nil then name = SpellIDToName(name) end
	local tempSpell = {GetSpellLink(name)}
	if tempSpell[1] ~= nil then
		return true
	else
		return false
	end
end

function ccrPlayerHasGlyph(name)
	-- Glyph ID
	if tonumber(name) ~= nil then
		for i = 1,3 do
			vGlyph={GetGlyphSocketInfo(i,1)}
			if vGlyph[4] == name then
				return true
			end
		end
		for i = 1,3 do
			vGlyph={GetGlyphSocketInfo(i,2)}
			if vGlyph[4] == name then
				return true
			end
		end
		return false
	else
		-- Glyph Name
		local glyphname = name
		for i=1,NUM_GLYPH_SLOTS do
			local glyphspellid = select(4,GetGlyphSocketInfo(i))
			if glyphspellid and glyphname == GetSpellInfo(glyphspellid) then
				return true
			end
		end	
		return false
	end
end

function ccrPlayerIsFacingTarget()
	if Target
	and Target:Exists()
	and Player:IsFacing(Target)
	then
		return true
	else
		return false
	end
end
